package com.guyu.common.web.config;

import com.guyu.common.web.config.properties.GyWebProperties;
import com.guyu.common.web.interceptor.GuyuWebInvokeTimeInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 通用配置
 *
 * @author Lion Li
 */
@AutoConfiguration
public class ResourcesConfig implements WebMvcConfigurer {
    @Autowired
    private GyWebProperties gyWebProperties;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 全局访问性能拦截
        registry.addInterceptor(new GuyuWebInvokeTimeInterceptor(gyWebProperties));
    }


}
